from selenium import webdriver
import time
from selenium.webdriver.common.by import By

dr = webdriver.Chrome()
dr.get("file:///C:/Users/Administrator/Desktop/自动化测试网页/自动化测试网页/注册实例.html")
time.sleep(2)
dr.maximize_window()
time.sleep(2)
# 主菜单的元素
dr.find_element(By.ID,"userA").send_keys("主页面的输入")
# 切换到其他frame
f1 = dr.find_element(By.ID,"idframe1")
dr.switch_to.frame(f1)
# 找到输入框
dr.find_element(By.ID,"AuserA").send_keys("注册A")
time.sleep(2)
# 切换回主页面
dr.switch_to.default_content()
# 切换到其他的frame
f2 = dr.find_element(By.ID,"idframe2")
dr.switch_to.frame(f2)
dr.find_element(By.ID,"BuserA").send_keys("注册B")
time.sleep(2)
dr.quit()